<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:ctg="http://www.crotouristguide.com/taglib"
	xmlns:c="http://java.sun.com/jstl/core">

<ui:component>
	<s:div id="topPanel">
		<a4j:outputPanel ajaxRendered="true">
		</a4j:outputPanel>
		<h:form id="form">
			<rich:panel id="topOtociPanel" styleClass="no-border"
				rendered="#{dynamicTopOtoci1.size() > 0}">
				<a4j:region renderRegionOnly="true">
					<s:div styleClass="title clearfix">
						<s:div styleClass="left">
							<h2><h:outputText value="#{messages['title.top_otoci']}" /></h2>
							<h:outputText value="#{messages['subtitle.top.islands']}" />
						</s:div>
						<s:div styleClass="right">
							<a4j:commandLink reRender="otociPanel" styleClass="txt11" status="s1">
								<f:param name="posjet" value="1" />
								<f:param name="idMjesta" value="#{param.idMjesta}" />
								<f:param name="idOtoka" value="#{param.idOtoka}" />
								<f:param name="idZupanije" value="#{param.idZupanije}" />
								<h:outputText value="#{messages['label.by.visits']}" />
							</a4j:commandLink>
							<h:outputText value=" | "></h:outputText>
							<a4j:commandLink reRender="otociPanel" styleClass="txt11" status="s1">
								<f:param name="posjet" value="2" />
								<f:param name="idMjesta" value="#{param.idMjesta}" />
								<f:param name="idOtoka" value="#{param.idOtoka}" />
								<f:param name="idZupanije" value="#{param.idZupanije}" />
								<h:outputText value="#{messages['label.by.reviews']}" />
							</a4j:commandLink>
							<ctg:status id="s1"/>
						</s:div>
					</s:div>

					<s:div id="otociPanel">
						<s:div styleClass="top1" rendered="#{dynamicTopOtoci.size() > 0}">
							<s:div styleClass="leftm">
								<h:outputLink
									value="#{application.contextPath}/guides/otoci/otok.seam">
									<f:param name="idOtoka"
										value="#{dynamicTopOtoci.get(0).idOtoka}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title"
										value="#{titleAction.getUrlTitle(dynamicTopOtoci.get(0))}" />
									<img class="leftm"
										src="#{slikaAction.getPocSlikaPath(dynamicTopOtoci.get(0), 's')}"
										alt="#{messages['label.image.alt']} #{alt}" width="105"
										height="75" />
								</h:outputLink>
							</s:div>
							<ol class="first">
								<li><h:outputLink
									value="#{application.contextPath}/guides/otoci/otok.seam">
									<f:param name="idOtoka"
										value="#{dynamicTopOtoci.get(0).idOtoka}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title"
										value="#{titleAction.getUrlTitle(dynamicTopOtoci.get(0))}" />
									<h:outputText value="#{dynamicTopOtoci.get(0).naziv}" />
								</h:outputLink></li>
							</ol>
							<p><h:outputText
								value="#{stringUtil.substring(dynamicTopOtoci.get(0).getOpis(currentLang).opis,280)}" />
							<h:outputLink
								rendered="#{dynamicTopOtoci.get(0).getOpis(currentLang) != null}"
								value="#{application.contextPath}/guides/otoci/otok.seam" styleClass="special2">
								<f:param name="idOtoka"
									value="#{dynamicTopOtoci.get(0).idOtoka}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title"
									value="#{titleAction.getUrlTitle(dynamicTopOtoci.get(0))}" />
								<h:outputText value="#{ messages['label.link.more']}" />
							</h:outputLink></p>
						</s:div>
						<s:div styleClass="top2">
							<ol start="2">
								<c:forEach items="#{dynamicTopOtoci}" var="otok" varStatus="s"
									begin="1" end="5">
									<li><h:outputLink
										value="#{application.contextPath}/guides/otoci/otok.seam">
										<f:param name="idOtoka" value="#{otok.idOtoka}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title" value="#{titleAction.getUrlTitle(otok)}" />
										<h:outputText value="#{otok.naziv}" />
									</h:outputLink></li>
								</c:forEach>
							</ol>
						</s:div>
						<s:div styleClass="top2">
							<ol start="7">
								<c:forEach items="#{dynamicTopOtoci}" var="otok" varStatus="s"
									begin="6" end="10">
									<li><h:outputLink
										value="#{application.contextPath}/guides/otoci/otok.seam">
										<f:param name="idOtoka" value="#{otok.idOtoka}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title" value="#{titleAction.getUrlTitle(otok)}" />
										<h:outputText value="#{otok.naziv}" />
									</h:outputLink></li>
								</c:forEach>
							</ol>
						</s:div>
						<br class="clearb" />
					</s:div>
				</a4j:region>
				<c:choose>
					<c:when test="#{param.idZupanije != null}">
						<c:set
							value="#{application.contextPath}/guides/zupanije/otoci.seam?idZupanije=#{param.idZupanije}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(zupanijaDetails)}"
							var="url"></c:set>
					</c:when>
					<c:otherwise>
						<c:set
							value="#{application.contextPath}/guides/otoci/list.seam?l=#{currentLang}"
							var="url"></c:set>
					</c:otherwise>
				</c:choose>

				<h:outputLink value="#{url}" styleClass="special1">
					<h:outputText value="#{messages['label.see.all.islands']}"></h:outputText>
				</h:outputLink>
			</rich:panel>
			<f:subview
				rendered="#{dynamicTopMjesta1.size() > 0 and dynamicTopOtoci1.size() > 0 and dynamicTopObjektiCount > 0 }">
				<s:div styleClass="rich-separator"></s:div>
			</f:subview>
			<rich:panel id="topMjestaPanel" styleClass="no-border"
				rendered="#{dynamicTopMjesta1.size() > 0}">
				<a4j:region renderRegionOnly="true">
					<s:div styleClass="title clearfix">
						<s:div styleClass="left">
							<h2><h:outputText
								value="#{messages['title.top_destinations']}" /></h2>
							<h:outputText styleClass="subtitle"
								value="#{messages['subtitle.top.dest']}" />
						</s:div>
						<s:div styleClass="right">
							<a4j:commandLink reRender="mjestaPanel" styleClass="txt11" status="s2">
								<f:param name="posjet" value="1" />
								<f:param name="idMjesta" value="#{param.idMjesta}" />
								<f:param name="idOtoka" value="#{param.idOtoka}" />
								<f:param name="idZupanije" value="#{param.idZupanije}" />
								<h:outputText value="#{messages['label.by.visits']}" />
							</a4j:commandLink>
							<h:outputText value=" | "></h:outputText>
							<a4j:commandLink reRender="mjestaPanel" styleClass="txt11" status="s2">
								<f:param name="posjet" value="2" />
								<f:param name="idMjesta" value="#{param.idMjesta}" />
								<f:param name="idOtoka" value="#{param.idOtoka}" />
								<f:param name="idZupanije" value="#{param.idZupanije}" />
								<h:outputText value="#{messages['label.by.reviews']}" />
							</a4j:commandLink>
							<ctg:status id="s2"/>
						</s:div>
					</s:div>
					<s:div id="mjestaPanel">
						<s:div styleClass="top1" rendered="#{dynamicTopMjesta.size() > 0}">
							<s:div styleClass="leftm">
								<h:outputLink
									value="#{application.contextPath}/guides/mjesta/mjesto.seam">
									<f:param name="idMjesta"
										value="#{dynamicTopMjesta.get(0).idMjesta}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title"
										value="#{titleAction.getUrlTitle(dynamicTopMjesta.get(0))}" />
									<img class="leftm"
										src="#{slikaAction.getPocSlikaPath(dynamicTopMjesta.get(0), 's')}"
										alt="#{messages['label.image.alt']} #{alt}" width="105"
										height="75" />
								</h:outputLink>
							</s:div>
							<ol class="first">
								<li><h:outputLink
									value="#{application.contextPath}/guides/mjesta/mjesto.seam">
									<f:param name="idMjesta"
										value="#{dynamicTopMjesta.get(0).idMjesta}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title"
										value="#{titleAction.getUrlTitle(dynamicTopMjesta.get(0))}" />
									<h:outputText value="#{dynamicTopMjesta.get(0).naziv}" />
								</h:outputLink></li>
							</ol>
							<p><h:outputText
								value="#{stringUtil.substring(dynamicTopMjesta.get(o).getOpis(currentLang).opis,280)}" />
							<h:outputLink
								rendered="#{dynamicTopMjesta.get(o).getOpis(currentLang) != null}"
								value="#{application.contextPath}/guides/mjesta/mjesto.seam" styleClass="special2">
								<f:param name="idMjesta"
									value="#{dynamicTopMjesta.get(0).idMjesta}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title"
									value="#{titleAction.getUrlTitle(dynamicTopMjesta.get(0))}" />
								<h:outputText value="#{ messages['label.link.more']}" />
							</h:outputLink></p>
						</s:div>
						<s:div styleClass="top2">
							<ol start="2">
								<c:forEach items="#{dynamicTopMjesta}" var="mjesto"
									varStatus="s" begin="1" end="10">
									<li><h:outputLink
										value="#{application.contextPath}/guides/mjesta/mjesto.seam">
										<f:param name="idMjesta" value="#{mjesto.idMjesta}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title"
											value="#{titleAction.getUrlTitle(mjesto)}" />
										<h:outputText value="#{mjesto.naziv}" />
									</h:outputLink></li>
								</c:forEach>
							</ol>
						</s:div>
						<s:div styleClass="top2">
							<ol start="12">
								<c:forEach items="#{dynamicTopMjesta}" var="mjesto"
									varStatus="s" begin="11" end="21">
									<li><h:outputLink
										value="#{application.contextPath}/guides/mjesta/mjesto.seam">
										<f:param name="idMjesta" value="#{mjesto.idMjesta}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title"
											value="#{titleAction.getUrlTitle(mjesto)}" />
										<h:outputText value="#{mjesto.naziv}" />
									</h:outputLink></li>
								</c:forEach>
							</ol>
						</s:div>
						<br class="clearb" />

					</s:div>

					<c:choose>
						<c:when test="#{param.idZupanije != null}">
							<c:set
								value="#{application.contextPath}/guides/zupanije/mjesta.seam?idZupanije=#{param.idZupanije}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(zupanijaDetails)}"
								var="url"></c:set>
						</c:when>
						<c:when test="#{param.idOtoka != null}">
							<c:set
								value="#{application.contextPath}/guides/otoci/mjesta.seam?idOtoka=#{param.idOtoka}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(otokDetails)}"
								var="url"></c:set>
						</c:when>
						<c:otherwise>
							<c:set
								value="#{application.contextPath}/guides/mjesta/list.seam?letter=B&amp;l=#{currentLang}"
								var="url"></c:set>
						</c:otherwise>
					</c:choose>
				</a4j:region>
				
				<h:outputLink value="#{url}"
					rendered="#{dynamicTopMjesta1.size > 0}" styleClass="special1">
					<h:outputText value="#{messages['label.see.all.places']}"></h:outputText>
				</h:outputLink>
			</rich:panel>
			<f:subview
				rendered="#{dynamicTopMjesta1.size() > 0 or dynamicTopOtoci1.size() > 0 and dynamicTopObjektiCount > 0}">
				<s:div styleClass="rich-separator"></s:div>
			</f:subview>
			<rich:panel id="topObjektiPanel" styleClass="no-border"
				rendered="#{dynamicTopObjektiCount > 0}">
				<s:div styleClass="title clearfix">
					<s:div styleClass="left">
						<h2><h:outputText value="#{messages['title.top_accomodation']}" /></h2>
						<h:outputText styleClass="subtitle"
							value="#{messages['subtitle.top.objects']}" />
					</s:div>
					<s:div styleClass="right">
						<a4j:commandLink reRender="objektiPanel" styleClass="txt11" status="s3">
							<f:param name="posjet" value="1" />
							<f:param name="idMjesta" value="#{param.idMjesta}" />
							<f:param name="idOtoka" value="#{param.idOtoka}" />
							<f:param name="idZupanije" value="#{param.idZupanije}" />
							<h:outputText value="#{messages['label.by.visits']}" />
						</a4j:commandLink>
						<h:outputText value=" | "></h:outputText>
						<a4j:commandLink reRender="objektiPanel" styleClass="txt11" status="s3">
							<f:param name="posjet" value="2" />
							<f:param name="idMjesta" value="#{param.idMjesta}" />
							<f:param name="idOtoka" value="#{param.idOtoka}" />
							<f:param name="idZupanije" value="#{param.idZupanije}" />
							<h:outputText value="#{messages['label.by.reviews']}" />
						</a4j:commandLink>
						<ctg:status id="s3"/>						
					</s:div>
				</s:div>

				<s:div id="objektiPanel">
					<rich:dataGrid value="#{dynamicTipoviObjekata}" var="to"
						stateVar="i" columnClasses="top,top,top,top" cellpadding="0"
						cellspacing="0" columns="3" width="100%">
						<c:set
							value="#{guides.getDynamicTopObjekti(guides.posjet,to.idTipaObjekta)}"
							var="l"></c:set>
						<s:div rendered="#{l.size() > 0}">
							<h3><h:outputText
								value="#{messages[stringUtil.merge('label.top_',to.idTipaObjekta)]}" /></h3>
							<h:outputLink rendered="#{l.size  > 0 }"
								value="#{application.contextPath}/guides/objekti/objekt.seam">
								<f:param name="idObjekta" value="#{l.get(0).idObjekta}" />
								<f:param name="l" value="#{currentLang}" />
								<f:param name="title"
									value="#{titleAction.getUrlTitle(l.get(0))}" />
								<img src="#{slikaAction.getPocSlikaPath(l.get(0), 's')}"
									alt="#{messages['label.image.alt']} #{alt}" width="105"
									height="75" />
							</h:outputLink>
							<br />
							<rich:dataOrderedList value="#{l}" rows="10" var="o">
								<h:outputLink
									value="#{application.contextPath}/guides/objekti/objekt.seam">
									<f:param name="idObjekta" value="#{o.idObjekta}" />
									<f:param name="l" value="#{currentLang}" />
									<f:param name="title" value="#{titleAction.getUrlTitle(o)}" />
									<h:outputText value="#{o.naziv}" />
								</h:outputLink>
								<f:subview rendered="#{param.idMjesta == null}">
									<h:outputText value=", " />
									<h:outputLink
										value="#{application.contextPath}/guides/mjesta/mjesto.seam">
										<f:param name="idMjesta" value="#{o.mjesto.idMjesta}" />
										<f:param name="l" value="#{currentLang}" />
										<f:param name="title"
											value="#{titleAction.getUrlTitle(o.mjesto)}" />
										<h:outputText value="#{o.mjesto.naziv}" />
									</h:outputLink>
								</f:subview>
							</rich:dataOrderedList>
							<c:choose>
								<c:when
									test="#{param.idMjesta == null and param.idOtoka == null and param.idZupanije == null}">
									<c:set value="" var="url"></c:set>
								</c:when>
								<c:when test="#{param.idMjesta != null }">
									<c:set
										value="/guides/mjesta/objekti.seam?idMjesta=#{param.idMjesta}&amp;idTipaObjekta=#{to.idTipaObjekta}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(mjestoDetails, to.idTipaObjekta)}"
										var="url"></c:set>
								</c:when>
								<c:when test="#{param.idOtoka != null }">
									<c:set
										value="/guides/otoci/objekti.seam?idOtoka=#{param.idOtoka}&amp;idTipaObjekta=#{to.idTipaObjekta}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(otokDetails,to.idTipaObjekta)}"
										var="url"></c:set>
								</c:when>
								<c:when test="#{param.idZupanije != null}">
									<c:set
										value="/guides/zupanije/objekti.seam?idZupanije=#{param.idZupanije}&amp;idTipaObjekta=#{to.idTipaObjekta}&amp;l=#{currentLang}&amp;title=#{titleAction.getUrlTitle(zupanijaDetails,to.idTipaObjekta)}"
										var="url"></c:set>
								</c:when>
							</c:choose>

							<h:outputLink rendered="#{url != ''}"
								value="#{application.contextPath}#{url}" styleClass="special2">
								<h:outputText value="#{messages['label.link.more']}" />
							</h:outputLink>
							<br/>
						</s:div>
					</rich:dataGrid>
				</s:div>
				<br/>
				<h:outputLink
					value="#{application.contextPath}/guides/objekti/searchSmjestaj.seam?l=#{currentLang}" styleClass="special1">
					<h:outputText value="#{messages['label.link.more_accomodation']}" />
				</h:outputLink>
			</rich:panel>
		</h:form>
	</s:div>
</ui:component>

</html>